package com.zyp.springdemo.entity;

import java.util.Map;

public class ResultTools {


    public static final int RESULT_SUCESS_CODE = 200;
    public static final String RESULT_SUCESS_MSG = "success";

    public static final int RESULT_ERR_CODE = 499;

    public static ResultModel resultSucess(Map<String, Object> map) {
        return result(RESULT_SUCESS_CODE, RESULT_SUCESS_MSG, map);
    }

    public static ResultModel resultError(String msg,Map<String, Object> map) {
        return result(RESULT_ERR_CODE, msg, map);
    }

    public static ResultModel result(int code, String msg, Map<String, Object> map) {
        ResultModel model = new ResultModel();
        model.setCode(code);
        model.setMsg(msg);
        if (map != null) {
            model.setData(map);
        }

        switch (code) {
            case 200:
                break;

            default:
                break;
        }
        return model;
    }

}
